package tech.aistar.corejava.day10.homework;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

import static tech.aistar.corejava.day03.IsLeapYear.isLeapYear;

/**
 * Created by 李雨昂 on 2019/7/26.
 */
public class Demo06 {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        String sdate = "2016-04-09";
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Date strDate = sdf.parse(sdate);
            //日期转换成日历
            cal.setTime(strDate);
            System.out.println(isLeapYear(cal.get(Calendar.YEAR))?"true":"false");
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
